import fetch from '@/utils/fetch'

export function addSPEventBasic(query) {
  return fetch({
    url: '/sp/addSPEventBasic',
    method: 'post',
    data: query
  })
}

export function getSPEventCode() {
  return fetch({
    url: '/sp/getSPEventCode',
    method: 'get'
  })
}

export function addSPEventInvolvedPersons(query) {
  return fetch({
    url: '/sp/addSPEventInvolvedPersons',
    method: 'post',
    data: query
  })
}

export function getSPEventReporterQuery(query) {
  return fetch({
    url: '/sp/getSPEventReporterQuery',
    method: 'post',
    params: {
        id: query.id,
        type: query.type,
        name: query.name,
        netGridID: query.netGridID,
        status: query.status,
        page: query.page,
        pageSize: query.pageSize
    }
  })
}

// /getSPEventDespatcherQuery
export function getSPEventDespatcherQuery(query) {
  return fetch({
    url: '/sp/getSPEventDespatcherQuery',
    method: 'post',
    params: {
        id: query.id,
        type: query.type,
        name: query.name,
        netGridID: query.netGridID,
        status: query.status,
        page: query.page,
        pageSize: query.pageSize
    }
  })
}

// getSPEventDeptDespatcherQuery
export function getSPEventDeptDespatcherQuery(query) {
  return fetch({
    url: '/sp/getSPEventDeptDespatcherQuery',
    method: 'post',
    params: {
        id: query.id,
        type: query.type,
        name: query.name,
        netGridID: query.netGridID,
        status: query.status,
        page: query.page,
        pageSize: query.pageSize
    }
  })
}

export function getSPEventHandlerQuery(query) {
  return fetch({
    url: '/sp/getSPEventHandlerQuery',
    method: 'post',
    params: {
        id: query.id,
        type: query.type,
        name: query.name,
        netGridID: query.netGridID,
        status: query.status,
        page: query.page,
        pageSize: query.pageSize
    }
  })
}

export function getSPEventAuditorQuery(query) {
  return fetch({
    url: '/sp/getSPEventAuditorQuery',
    method: 'post',
    params: {
      id: query.id,
      type: query.type,
      name: query.name,
      netGridID: query.netGridID,
      status: query.status,
      page: query.page,
      pageSize: query.pageSize
    }
  })
}

// /changeSPEventStatus
export function changeSPEventStatus(type, id) {
  return fetch({
    url: '/sp/changeSPEventStatus',
    method: 'post',
    params: {
      type: type,
      id: id
    }
  })
}

// /getUserInfoByKey
export function getUserInfoByKey(params) {
  return fetch({
    url: '/sp/getUserInfoByKey',
    method: 'post',
    params:params
  })
}

// /insertSPEventDistribute 上传派发信息
export function insertSPEventDistribute(query) {
  return fetch({
    url: '/sp/insertSPEventDistribute',
    method: 'post',
    data: query
  })
}

// insertSPEventChecked
export function insertSPEventChecked(query) {
  return fetch({
    url: '/sp/insertSPEventChecked',
    method: 'post',
    data: query
  })
}

// 上传处理信息
// /insertSPEventDealing
export function insertSPEventDealing(query) {
  return fetch({
    url: '/sp/insertSPEventDealing',
    method: 'post',
    data: query
  })
}



export function getSPDetail(id) {
  return fetch({
    url: '/sp/getSPEventDetail',
    method: 'post',
    params: {
      id: id
    }
  })
}

export function getDetailToUpdate(id) {
  return fetch({
    url: '/sp/getDetailToUpdate',
    method: 'post',
    params: {
      SPEventID: id
    }
  })
}

export function updateSPEvent(params) {
  return fetch({
    url: '/sp/updateSPEvent',
    method: 'post',
    data: params
  })
}

export function updateSPEventInvolvedPersons(query) {
  return fetch({
    url: '/sp/updateSPEventInvolvedPersons',
    method: 'post',
    data: query
  })
}

export function deleteSPEventInvolvedPersons(id) {
  return fetch({
    url: '/sp/deleteSPEventInvolvedPersons',
    method: 'get',
    params: {
      id: id
    }
  })
}

export function deleteSPEvent(id) {
  return fetch({
    url: '/sp/deleteSPEvent',
    method: 'post',
    params: {
      id: id
    }
  })
}

export function getSPEventCount(){
  return fetch({
    url:'/sp/getSPEventCount',
    method:'get'
  })
}

export function getSPProcessionQuery(query){
  return fetch({
    url:'/sp/getSPProcessionQuery',
    method:'post',
    params:{
      processionName:query.processionName,
      processionLeaderName:query.processionLeaderName,
      area:query.area,
      page:query.page,
      pageSize:query.pageSize
    }
  })
}

export function addProcession(query){
  return fetch({
    url:'/sp/addProcession',
    method:'post',
    data:query
  })
}
export function updateProcession(query){
  return fetch({
    url:'/sp/updateProcession',
    method:'post',
    data:query
  })
}

export function getProcessionDetail(id){
  return fetch({
    url:'/sp/getProcessionDetailByID',
    method:'post',
    params:{
      id:id
    }
  })
}
export function getProcessionDetailToUpdate(id){
  return fetch({
    url:'/sp/getProcessionDetailToUpdate',
    method:'post',
    params:{
      id:id
    }
  })
}

export function getAllProcession(){
  return fetch({
    url:'/sp/getAllProcession',
    method:'post',
  })
}

export function deleteProcession(id){
  return fetch({
    url:'/sp/deleteProcession',
    method:'post',
    params:{
      id:id
    }
  })
}

export function addSPRegion(query){
  return fetch({
    url:'/sp/addSPRegion',
    method:'post',
    data:query
  })
}

export function updateSPRegion(query){
  return fetch({
    url:'/sp/updateSPRegion',
    method:'post',
    data:query
  })
}

export function deleteSPRegion(id){
  return fetch({
    url:'/sp/deleteSPRegion',
    method:'post',
    params:{
      id:id
    }
  })
}

export function selectByRegionName(name){
  return fetch({
    url:'/sp/selectByRegionName',
    method:'post',
    params:{
      name:name
    }
  })
}

export function selectAllRegion(){
  return fetch({
    url:'/sp/selectAllRegion',
    method:'post'
  })
}

export function getProcessionDetailByInspectionArea(id){
  return fetch({
    url:'/sp/getProcessionDetailByInspectionArea',
    method:'post',
    params:{
      id:id
    }
  })
}

export function addProcessionPerson(query,id){
  return fetch({
    url:'/sp/addProcessionPerson?id='+id,
    method:'post',
    data:query
  })
}
export function updateSPProcessionPerson(query){
  return fetch({
    url:'/sp/updateSPProcessionPerson',
    method:'post',
    data:query
  })
}

export function getProcessionPersonQuery(query){
  return fetch({
    url:'/sp/getProcessionPersonQuery',
    method:'post',
    params:query
  })
}

export function getProcessionPersonDetail(id){
  return fetch({
    url:'/sp/getProcessionPersonDetail',
    method:'post',
    params:{
      id:id
    }
  })
}

export function getProcessionPersonDetailToUpdate(id){
  return fetch({
    url:'/sp/getProcessionPersonDetailToUpdate',
    method:'post',
    params:{
      id:id
    }
  })
}

export function deleteSPProcessionPerson(id){
  return fetch({
    url:'/sp/deleteSPProcessionPerson',
    method:'post',
    params:{
      id:id
    }
  })
}

export function getSPTrailQuery(query){
  return fetch({
    url:'/sp/getSPTrailQuery',
    method:'post',
    params:{
      name:query.name,
      startTime:query.startTime,
      endTime:query.endTime,
      page:query.page,
      pageSize:query.pageSize
    }
  })
}
